import request from "../request.js"
import listUtils from "@/utils/ListUtils.js"
/**
 *  话题相关的请求接口
 */
const token = uni.getStorageSync('token');
export default {
	
	getCommunityIndexData(){
		return request("/community/index/", "GET")
	},
	
	getCommunityInfoByCommunityId(communityId){
		return request(`/community/community/${communityId}`,"GET")
	},
	getTopicTopByCommunityId(communityId){
		return request(`/community/topicTop/${communityId}`,"GET")
	},
	getTopicCategoryByCommunityId(communityId){
		return request(`/community/topicCategory/${communityId}`,"GET")
	},
	getTopicByCommunityIdAndTopicCategoryId(communityId,topicCategoryId,pageParams){
		return request(`/community/topic/${communityId}/${topicCategoryId}`,"POST",pageParams)
	},
	getCheckinByMemberId(communityId,memberId){
		return request(`/community/checkinStatus/${communityId}/${memberId}`,"GET")
	},
	checkinByMemberId(communityId,memberId){
		return request(`/community/checkin/${communityId}/${memberId}`,"POST")
	},
	getTopicInfoByTopicId(topicId){
		return request(`/community/topicInfo/${topicId}`,"GET")
	},
	getTopicCommentByTopicId(topicId,pageParams){
		return request(`/community/topicComments/${topicId}`,"POST",pageParams)
	},
	saveTopic(dataForm){
		return request(`/community/topic`,"POST",dataForm)
	},
	saveComment(commentForm){
		return request(`/community/comment`,"POST",commentForm)
	},
	//批量查询话题详情
	batchTopicInfo(idList) {
		return request("/community/topic/batch/info/", "POST",listUtils.removeRepeat(idList))
	},
	//批量查询评论详情
	batchCommentInfo(idList) {
		return request("/community/comment/batch/info/", "POST",listUtils.removeRepeat(idList))
	},
	
	// 根据用户id分页查询主题
	listTopicByUserId(userId,page){
		return request(`/community/topic/listByUserId/${userId}`, "POST",page)
	},
	
	//根据用户id分页查询评论
	listCommentByUserId(userId,page){
		return request(`/community/comment/listByUserId/${userId}`, "POST",page)
	},
	
	//获取社区分类 -> 联查VO
	getCommunityCategoryForOption(){
		return request(`/community/communityCategory/option`, "GET")
	},
	
	//根据ID获取社区 -> 联查VO
	getCommunityForOptionById(id){
		return request(`/community/community/option/${id}`, "GET")
	},
	
	//根据ID获取话题分类 -> 联查VO
	getTopicCategoryForOptionById(id){
		return request(`/community/topicCategory/option/${id}`, "GET")
	},
	
	//根据id获取评论详情
	getCommentInfoById(id){
		return request(`/community/topic/commentInfo/${id}`, "GET")
	}
}
